<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EpeListadoEje.aspx.cs" MasterPageFile="~/MasterPageMcSigAdmin.master"
    Inherits="EpeListadoEje" %>

<%@ Register assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView.Export" tagprefix="dxwgv" %>
<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>
<%@ Register Assembly="UsrControls" Namespace="UsrControls" TagPrefix="cc1" %>
<%@ Register Assembly="Anthem" Namespace="Anthem" TagPrefix="anthem" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <script language="javascript" type="text/javascript">
    function OnGridSelectionChanged() {
    var counter = document.getElementById("selCount");
    if(counter != null) 
    setInnerText(counter, ctl00_ContentPlaceHolder1_gidvAccionEpeDev.GetSelectedRowCount().toString());
    
    ctl00_ContentPlaceHolder1_gidvAccionEpeDev.GetSelectedFieldValues('PRG_NOMBRE', OnGridSelectionComplete);
}
function OnGridSelectionComplete(values) {
    selList.BeginUpdate();
    selList.ClearItems();
    for(var i = 0; i < values.length; i ++) {
        selList.AddItem(values[i]);
    }
    selList.EndUpdate();
}
function setInnerText(element, text) { 
    if(typeof element.textContent != 'undefined') { 
        element.textContent = text; 
    } 
    else if (typeof element.innerText != 'undefined') { 
        element.innerText = text; 
    } 
    else if (typeof element.removeChild != 'undefined') { 
        while (element.hasChildNodes()) { 
            element.removeChild(element.lastChild); 
        } 
        element.appendChild(document.createTextNode(text)); 
    } 
}

function confirmEdit()
{
var counter = ctl00_ContentPlaceHolder1_gidvAccionEpeDev.GetSelectedRowCount();

if (counter > 1)
    {
    counter = 0;
        alert("Debe seleccionar un solo registro");
        return(false);
    }
    else if (counter == 1)
    {
    counter = 0;
        return(true);
    }
    else if (counter == 0)
    {
    counter = 0;
    alert("Debe seleccionar al  menos un registro");
        return(false);
    }
}
function delete_PreCallBack(button) 
{
var counter = ctl00_ContentPlaceHolder1_gidvAccionEpeDev.GetSelectedRowCount();

if (counter > 0)
    {
        return confirm ('Esta seguro de eliminar los registros seleccionados?')
    }
  alert("Debe seleccionar por lo menos un registro");
    return(false);
  
}

function confirmDelete () 
{ 
		var frm;
		
		if (arguments.length > 0)
		{
			frm = arguments[0];
		}
		else
		{
			frm =document.forms[0];
		}



    // loop through all elements
    for (i=0; i<frm.length; i++) 
    {
        // Look for our checkboxes only
        if (frm.elements[i].name.indexOf("chkId") !=-1) 
        {
            // If any are checked then confirm alert, otherwise nothing happens
            if(frm.elements[i].checked) 
            {
                return confirm ('Esta seguro de eliminar los registros seleccionados?')
            }
        }
    }
    alert("Debe seleccionar por lo menos un registro");
    return(false);
}
    </script>

    <h1>
        EPE</h1>
    <div class="borde">
        <table width="100%" class="content-box">
            <tr>
                <td colspan="2" class="box-header">
                    <h2>
                        <asp:Label ID="lblDependencia" runat="server"></asp:Label></h2>
                </td>
            </tr>
            <tr>
                <td style="width: 10%">
                    Rubro</td>
                <td>
                    <asp:LinkButton ID="lblDescripcionRubro" runat="server" CausesValidation="False"
                        OnClick="lblDescripcionRubro_Click"></asp:LinkButton></td>
            </tr>
            <tr>
                <td>
                    Valor apropiacion</td>
                <td>
                    <asp:Label ID="lblValorApropiacion" runat="server"></asp:Label></td>
            </tr>
            <tr>
                <td>
                    Sub actividad</td>
                <td>
                    <asp:LinkButton ID="lblAccion" runat="server" OnClick="lblAccion_Click"></asp:LinkButton></td>
            </tr>
            <tr>
                <td>
                    Valor</td>
                <td>
                    <asp:Label ID="lblValorAccion" runat="server"></asp:Label></td>
            </tr>
        </table>
    </div>
    <anthem:Label ID="lblMensaje" runat="server"></anthem:Label>
    <div class="toolbar">
        <asp:ImageButton CssClass="regresar" ID="btnRegresar" runat="server" CausesValidation="False"
            ImageUrl="~/Imagenes/bt-regresar.gif" OnClick="btnRegresar_Click" />
        <cc1:WccAcciones ID="WccAcciones1" runat="server" AddCausesValidation="False" AddEnableCallBack="False"
            ArchiveVisible="False" AuditVisible="False" DeclineVisible="False" DeleteEnableCallBack="True"
            DeletePreCallBackFunction="delete_PreCallBack" OnAdd_OnClick="WccAcciones1_Add_OnClick"
            OnDelete_OnClick="WccAcciones1_Delete_OnClick" OnUpdate_OnClick="WccAcciones1_Update_OnClick"
            PublishVisible="False" UpdateCausesValidation="False" UpdateEnableCallBack="False"
            UpdateOnClickFunction="return confirmEdit();" ValidateVisible="False"></cc1:WccAcciones>
    </div>
    <table class="tabs">
        <tr>
            <td class="tab-inactivo" runat="server" visible="false">
                <anthem:LinkButton ID="lnkAccionesMetas" runat="server" CausesValidation="False"
                    EnableCallBack="False" OnClick="lnkAccionesMetas_Click" OnClientClick="return confirmEdit();">Metas</anthem:LinkButton>
            </td>
            <td class="tab-activo">
                &nbsp;<anthem:LinkButton ID="LinkEpes" runat="server" CausesValidation="False" EnableCallBack="False"
                    Enabled="False" OnClientClick="return confirmEdit();">EPEs</anthem:LinkButton></td>
            <td class="tab-inactivo" runat="server" visible="false">
                <anthem:LinkButton ID="LinkContratos" runat="server" CausesValidation="False" EnableCallBack="False"
                    OnClick="LinkContratos_Click" Visible="false" OnClientClick="return confirmEdit();">Contratos</anthem:LinkButton></td>
        </tr>
    </table>
    <div class="overflow bt-space15">
        <dxwgv:ASPxGridView ID="gidvAccionEpeDev" runat="server" AutoGenerateColumns="False"
            CssFilePath="~/App_Themes/Plastic Blue/{0}/styles.css" CssPostfix="PlasticBlue"
            KeyFieldName="FAE_ID" Width="100%" 
            OnRowCommand="gidvAccionEpeDev_RowCommand" Theme="PlasticBlue">
            <SettingsPager AlwaysShowPager="True" ShowDefaultImages="False">
                <AllButton Text="Todos" Visible="True">
                </AllButton>
                <NextPageButton Text="Anterior &gt;">
                </NextPageButton>
                <PrevPageButton Text="&lt; Siguiente">
                </PrevPageButton>
            </SettingsPager>
            
            <Styles CssFilePath="~/App_Themes/Plastic Blue/{0}/styles.css" CssPostfix="PlasticBlue">
                <Header ImageSpacing="10px" SortingImageSpacing="10px">
                </Header>
                <SelectedRow BackColor="Maroon">
                </SelectedRow>
            </Styles>
            <Columns>
                <dxwgv:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0" Width="20px">
                    <ClearFilterButton Visible="True">
                    </ClearFilterButton>
                </dxwgv:GridViewCommandColumn>
                <dxwgv:GridViewDataTextColumn Caption="FAE_ID" FieldName="FAE_ID" Visible="False"
                    VisibleIndex="1">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="Objeto" FieldName="FAE_OBJETO" VisibleIndex="1"
                    Width="450px">
                    <EditCellStyle Wrap="True">
                    </EditCellStyle>
                    <FilterCellStyle Wrap="True">
                    </FilterCellStyle>
                    <EditFormCaptionStyle Wrap="True">
                    </EditFormCaptionStyle>
                    <HeaderStyle Wrap="True" />
                    <CellStyle Wrap="True">
                    </CellStyle>
                    <FooterCellStyle Wrap="True">
                    </FooterCellStyle>
                    <GroupFooterCellStyle Wrap="True">
                    </GroupFooterCellStyle>
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="Numero EP" FieldName="FAE_NUMEROEPE" VisibleIndex="2"
                    Width="50px">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="Valor EP" FieldName="FAE_VALOR_EPE" VisibleIndex="3"
                    Width="120px">
                    <PropertiesTextEdit DisplayFormatString="{0:N0}">
                    </PropertiesTextEdit>
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataHyperLinkColumn Caption="Datos Adicionales" ToolTip="Datos Adicionales"
                    Visible="False" VisibleIndex="1">
                    <DataItemTemplate>
                        <table>
                            <tr>
                                <td>
                                    <anthem:LinkButton ID="lnkEjecucion" runat="server" AutoUpdateAfterCallBack="True"
                                        Visible='<%#Eval("FAE_ID") == System.DBNull.Value ? false :  true%>' CommandName="cmdVerDetalle">Ver Detalle</anthem:LinkButton>
                                </td>
                            </tr>
                        </table>
                    </DataItemTemplate>
                    <CellStyle Wrap="True">
                    </CellStyle>
                </dxwgv:GridViewDataHyperLinkColumn>
                <dxwgv:GridViewDataTextColumn Caption="Estado" FieldName="TPE_NOMBRE" VisibleIndex="4"
                    Width="150px">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="N&#250;mero CDP" FieldName="FAE_NUMERO_CDP"
                    VisibleIndex="5" Width="50px">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="Fecha CDP" FieldName="FAE_FECHA_CDP" VisibleIndex="6"
                    Width="60px">
                    <PropertiesTextEdit DisplayFormatString="dd/MM/yyyy">
                    </PropertiesTextEdit>
                    <Settings AutoFilterCondition="Contains" />
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="Valor CDP" FieldName="FAE_VALOR_CDP" VisibleIndex="7"
                    Width="120px">
                    <PropertiesTextEdit DisplayFormatString="{0:N0}">
                    </PropertiesTextEdit>
                </dxwgv:GridViewDataTextColumn>
            </Columns>
            <TotalSummary>
                <dxwgv:ASPxSummaryItem FieldName="FAE_VALOR_EPE" SummaryType="Sum" ShowInColumn="FAE_VALOR_EPE"
                    DisplayFormat="{0:N0}" />
                <dxwgv:ASPxSummaryItem DisplayFormat="{0:N0}" FieldName="FAE_VALOR_CDP" ShowInColumn="FAE_VALOR_CDP"
                    SummaryType="Sum" />
                <dxwgv:ASPxSummaryItem DisplayFormat="{0:N0}" FieldName="CTT_VALOR_CONTRATO" ShowInColumn="CTT_VALOR_CONTRATO"
                    SummaryType="Sum" />
            </TotalSummary>
            <SettingsBehavior ColumnResizeMode="Control" />
            <Settings ShowFooter="True" ShowFilterRow="True" ShowFilterBar="Visible" 
                ShowFilterRowMenu="True" />
        </dxwgv:ASPxGridView>
    </div>
    <dxwgv:ASPxGridViewExporter ID="gridExport" runat="server" GridViewID="gidvAccionEpeDev">
    </dxwgv:ASPxGridViewExporter>
    <asp:Button ID="btnXlsExport" runat="server" OnClick="btnXlsExport_Click" Text="Exportar a XLS"
        CssClass="button l" /><asp:Button ID="btnRtfExport" runat="server" OnClick="btnRtfExport_Click"
            Text="Exportar a RTF" CssClass="button l" /><asp:Button ID="btnCsvExport" runat="server"
                OnClick="btnCsvExport_Click" Text="Exportar a CSV" CssClass="button l" />
    <cc1:PopupPanel ID="PopupPanel1" runat="server" Height="560px" Width="680px">
        <table>
            <tr style="height: 21px">
                <td class="est-tablagris" style="width: 2%">
                </td>
                <td class="est-tablagris">
                </td>
                <td class="est-tablagris" rowspan="1" style="width: 2%; height: 2%">
                    <anthem:ImageButton ID="btnCerrar" runat="server" ImageUrl="Imagenes/fancy_close.png"
                        AutoUpdateAfterCallBack="True" OnClick="btnCerrar_Click" />
                </td>
            </tr>
            <tr>
                <td class="est-tablagris" style="width: 18px">
                </td>
                <td>
                    <table border="1" width="100%">
                        <tr>
                            <td style="width: 50%">
                                Numero EPE</td>
                            <td style="width: 50%">
                                <anthem:Label ID="lblFAE_NUMEROEPE" runat="server" Font-Size="Small"></anthem:Label></td>
                        </tr>
                        <tr style="font-size: 12pt">
                            <td>
                                Fecha</td>
                            <td>
                                <anthem:Label ID="lblFAE_FECHA" runat="server" Font-Size="Small"></anthem:Label></td>
                        </tr>
                        <tr style="font-size: 12pt">
                            <td>
                                Justificacion</td>
                            <td style="width: 50%">
                                <div id="divJustificacion">
                                </div>
                                <anthem:TextBox ID="lblFAE_JUSTIFICACION" runat="server" Height="250px" ReadOnly="True"
                                    TextMode="MultiLine" Width="100%"></anthem:TextBox></td>
                        </tr>
                        <tr style="font-size: 12pt">
                            <td>
                                Objeto</td>
                            <td>
                                <anthem:Label ID="lblFAE_OBJETO" runat="server" Font-Size="Small"></anthem:Label></td>
                        </tr>
                        <tr style="font-size: 12pt">
                            <td>
                                Numero Convenio</td>
                            <td>
                                <anthem:Label ID="lblFAE_NUMERO_CONVENIO" runat="server" Font-Size="Small"></anthem:Label></td>
                        </tr>
                        <tr style="font-size: 12pt">
                            <td>
                                Valor</td>
                            <td>
                                <anthem:Label ID="lblFAE_VALOR" runat="server" Font-Size="Small"></anthem:Label></td>
                        </tr>
                        <tr style="font-size: 12pt">
                            <td>
                                Numero CDP</td>
                            <td>
                                <anthem:Label ID="lblFAE_NUMERO_CDP" runat="server" Font-Size="Small"></anthem:Label></td>
                        </tr>
                        <tr style="font-size: 12pt">
                            <td>
                                Valor CDP</td>
                            <td>
                                <anthem:Label ID="lblFAE_VALOR_CDP" runat="server" Font-Size="Small"></anthem:Label></td>
                        </tr>
                    </table>
                </td>
                <td class="est-tablagris" style="font-size: 12pt">
                </td>
            </tr>
        </table>
    </cc1:PopupPanel>
</asp:Content>
